@extends('admin/layout')
@section('title','添加广告')
@section('content')
<!-- Content Header (Page header) -->
<section class="content-header">
    <h1>
        广告管理
        @if(session('error'))
            <div class="alert alert-danger">
                <li>{{ session('error') }}</li>
            </div>
        @endif
        <small>添加广告</small>
        @if (count($errors) > 0)
            <div class="alert alert-danger">
                <ul>
                    @foreach ($errors-> all() as $error)
                        <li>{{ $error }}</li>
                    @endforeach
                </ul>
            </div>
        @endif
    </h1>
    <ol class="breadcrumb">
        <li><a href="{{asset('admin/index')}}"><i class="fa fa-th"></i> 管理首页</a></li>
        <li><i class="fa fa-users"></i> 广告管理</li>
        <li class="active">添加广告</li>
    </ol>
</section>
<section class="content">
    <div class="box box-primary">
        <div class="box-header with-border">
            <h3 class="box-title">添加广告</h3>
        </div><!-- /.box-header -->
        <!-- form start -->
        <form action="/admin/ad" method="post" enctype="multipart/form-data">
            {{ csrf_field() }}
            <div class="box-body">
                <div class="form-group">
                    <label for="exampleInputEmail1">广告名称</label>
                    <input type="text" name="name" class="form-control" id="exampleInputEmail1"
                           placeholder="请输入广告名称">
                </div>
                <div class="form-group">
                    <label for="exampleInputPassword1">广告类型</label>
                    <select class="form-control" name="class">
                        <option value="1">公示广告</option>
                        <option value="2">轮播广告</option>
                        <option value="3">注册页面</option>
                    </select>
                </div>
                <div class="form-group">
                    <label for="exampleInputEmail1">广告链接地址</label>
                    <input type="text" class="form-control" name="link" id="exampleInputEmail1"
                           placeholder="请输入网址">
                </div>
                <div class="form-group">
                    <label for="exampleInputFile">广告图片</label>
                    <ul id="warp">
                        <li style="list-style-type: none;">
                            <img id="imgShow_WU_FILE_0"  />
                            <input type="file" id="up_img_WU_FILE_0" name="ad_pic" />
                        </li>
                    </ul>
                    <p class="help-block">请选择您要上传的图片</p>
                </div>
            </div><!-- /.box-body -->

            <div class="box-footer">
                <button type="submit" class="btn btn-primary">提交</button>
                <button type="reset" class="btn btn-primary">重置</button>
            </div>
        </form>
        <script>
            $('.form-control').on('focus', function () {
                $(this).css('border','1px solid blue');
            }).on('blur', function () {
                if($(this).val().length <1)
                {
                    $(this).css('border','1px solid red');
                }
            });
        </script>
    </div><!-- /.box -->
</section>
@stop